package com.shijiwei.trip.ui;

import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.FrameLayout;
import android.widget.RadioGroup;

import com.shijiwei.trip.R;
import com.shijiwei.trip.fragment.CityFragment;
import com.shijiwei.trip.fragment.DestinationFragment;
import com.shijiwei.trip.fragment.MyFragment;
import com.shijiwei.trip.fragment.RecommendFragment;
import com.shijiwei.trip.utils.FragmentUtils;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    @ViewInject(R.id.rg_main_menu)
    private RadioGroup radioGroup;

    private RecommendFragment recommendFragment;
    private CityFragment cityFragment;
    private DestinationFragment destinationFragment;
    private MyFragment myFragment;

    private List<Fragment> fragments;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        x.view().inject(this);
        initData();
        FragmentUtils utils = new FragmentUtils(fragments,radioGroup,getSupportFragmentManager(),R.id.container);

    }

    private void initData() {
        fragments = new ArrayList<Fragment>();
        recommendFragment = RecommendFragment.newInstance();
        cityFragment = CityFragment.newInstance();
        destinationFragment = DestinationFragment.newInstance();
        myFragment = MyFragment.newInstance();
        fragments.add(recommendFragment);
        fragments.add(cityFragment);
        fragments.add(destinationFragment);
        fragments.add(myFragment);

    }
}
